package com.matt.foundation.vo;

import com.dotflat.util.excelUtil.Excel;
import com.matt.foundation.DO.ChildrenCheckRecordDO;
import com.matt.foundation.utils.DateUtil;
import lombok.Data;

import java.util.Date;


/**
 * *******************************
 * Created by Ron.
 * form com.matt
 * on 2017/7/25
 * *******************************
 */
@Data
public class ChildrenCheckRecordVo {

    private String childrenId;
    @Excel(name = "学生名称")
    private String childrenName;
    private String imgUrl;
    @Excel(name = "月龄")
    private Integer gender;
    @Excel(name = "缺席状态")
    private Integer checkStatus;
    private Date checkTime;

    private Date checkInTime;
    private Date checkOutTime;

    @Excel(name = "晨检状态")
    private Integer healthyStatus;
    private String sickName;
    private Integer month;
    private String remark;

    public static ChildrenCheckRecordVo of(ChildrenCheckRecordDO checkRecordDO){
        ChildrenCheckRecordVo vo = new ChildrenCheckRecordVo();
        vo.setChildrenId(checkRecordDO.getChildrenId());
        vo.setChildrenName(checkRecordDO.getChildrenName());
        vo.setImgUrl(checkRecordDO.getImgUrl());
        vo.setGender(checkRecordDO.getGender());
        vo.setCheckStatus(checkRecordDO.getCheckStatus());
        vo.setCheckTime(checkRecordDO.getCheckTime());

        vo.setCheckInTime(checkRecordDO.getCheckInTime());
        vo.setCheckOutTime(checkRecordDO.getCheckOutTime());

        vo.setHealthyStatus(checkRecordDO.getHealthyStatus());
        vo.setSickName(checkRecordDO.getSickName());

        if (checkRecordDO.getBirthday() != null) {
            vo.setMonth(DateUtil.betweenMonths(new Date(), checkRecordDO.getBirthday()));
        }

        vo.setRemark(checkRecordDO.getRemark());
        return vo;
    }
}
